<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
    <!-- <link rel="stylesheet" type="text/css" href="{$_G['URL']['YX2020_CSS']}css/reset.css"> -->

    <script src="https://css2020.yixuan.net/2020css/yx2020/js/jquery.js?v=2"></script>
    <link rel="stylesheet" type="text/css" href="https://css2020.yixuan.net/2020css/yx2020/css/reset.css">
    <link rel="stylesheet" type="text/css" href="https://css2020.yixuan.net/2020css/yx2020/css/swiper.min.css">
    {if $config['weixinh5']==2}
    <script src="{$_G['URL']['YX2020_CSS']}js/vconsole.min.js"></script>
    <script> var vConsole = new VConsole(); </script>
    {/if}

    <script src="https://css2020.yixuan.net/2020css/yx2020/js/swiper-3.4.2.min.js"></script>
    <script src="{$_G['URL']['LOTTERY_CSS']}lottery/js/layer/layer.js"></script>
    <script>
        init();
        window.onresize = init;
        function init(){
            document.documentElement.style.fontSize =
                document.documentElement.clientWidth / 7.5 + 'px';
        }
    </script>
    <title>{$theme['title']}-选择课程</title>
    <style>
        body{
            padding-bottom: 1.13rem;
        }
        .wrap .content{
            background: #f7f7f7;
            padding-top: 0.14rem;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        .wrap .content .li{
            display: flex;
            justify-content: flex-start;
            align-items: center;
            padding: 0.19rem 0.11rem 0.17rem;
            background: #ffffff;
            border-bottom: 0.01rem solid #f7f7f7;
        }
        .wrap .content .li .checkbox,.footer .checkbox{
            padding-left: 0.15rem;
            padding-right: 0.4rem;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-grow: 5;
        }
        .wrap .content .li .checkbox .checkbox_img,.footer .checkbox .checkbox_img{
            width: 0.22rem;
            height: 0.17rem;
            display: none;
        }
        .wrap .content .li .input,.footer .checkbox .input{
            width: 0.37rem;
            height: 0.37rem;
            border-radius: 0.37rem;
            background: #eee;
            border: 0.01rem solid #ccc;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .wrap .content .li input:checked+.input,.footer .checkbox input:checked+.input{
            background-image: linear-gradient(to top,#f8277a,#fe848d);
        }
        .wrap .content .li input:checked+.input .checkbox_img,.footer .checkbox input:checked+.input .checkbox_img{
            display: block;
        }
        .wrap .content .li input,.footer .checkbox input{
            display: none;
        }
        .wrap .content .head_img{
            max-width: 1.66rem;
            max-height: 1.66rem;
            border-radius: 0.14rem;
            flex-grow: 7;
        }
        .wrap .content .li .right{
            color: #999999;
            font-size: 0.24rem;
            padding-left: 0.4rem;
            flex-grow: 15;
            width: 4.2rem;
        }
        .wrap .content .li .right .tit{
            width: 4.2rem;
            color: #333333;
            font-size: 0.28rem;
            line-height: 1.6em;
            padding: 0.1rem 0;
        }
        .wrap .b_content .li .right .tit{
            line-height: 0.5rem;
        }

        .wrap .content .li .right .data{
            display: flex;
            justify-content: flex-start;
            padding-top: 0.16rem;
            line-height: 0.42rem;
        }
        .wrap .content .li .right .data .d_left,.wrap .content .li .right .data .d_right{
            display: flex;
            flex-direction: column;
        }
        .wrap .content .li .right .data .d_left{
            padding-right: 0.2rem;
            position: relative;
        }
        .wrap .content .li .right .data .d_left::after{
            content: "";
            position: absolute;
            top: 0;
            bottom: 0;
            right: 0;
            width: 0.01rem;
            min-width: 1px;
            height: 0.26rem;
            margin: auto;
            background: #eeeeee;
        }
        .wrap .content .li .right .data .d_right{
            padding-left: 0.2rem;
        }
        .wrap .content .li .right .data .d_right .dr_t{
            font-size: 0.28rem;
            color: #f91d76;
        }
        .wrap .content .li .right .data .d_right .dr_b{
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .wrap .content .li .right .data .d_right .dr_b img{
            width: 0.21rem;
            height: 0.21rem;
            margin-right: 0.07rem;
        }
        .wrap .content .li .right .name{
            display: flex;
            justify-content: flex-start;
            align-items: center;
            margin-bottom: 0.1rem;
            margin-top: 0.1rem;
        }
        .wrap .content .li .right .name span{
            color: #5086ff;
            background: #ecf5ff;
            line-height: 0.32rem;
            padding: 0 0.08rem;
            font-size: 0.2rem;
            border-radius: 0.06rem;
        }
        .wrap .content .li .right .d_txt{
            color: #999999;
            font-size: 0.24rem;
            line-height: 0.38rem;
        }
        .wrap .content .li .right .d_txt span{
            font-size: 0.26rem;
            color: #f91d76;
        }

        .footer{
            position: fixed;
            bottom: 0;
            background: #ffffff;
            width: 7.5rem;
            left: 0;
            right: 0;
            box-shadow: 0 -0.1rem 0.2rem 0 rgba(200,200,200,0.5);
            display: flex;
            justify-content: space-between;
            align-items: center;
            height: 1.13rem;
            z-index: 2;
        }
        .footer .button{
            width: 3.86rem;
            height: 0.86rem;
            background:linear-gradient(to right,#f82079,#fe878e);
            color: #ffffff;
            font-size: 0.28rem;
            display: flex;
            justify-content: center;
            align-items: center;
            margin-right: 0.26rem;
            border-radius: 0.2rem;
        }
        .footer .button a{
            color: #ffffff;
        }
        .footer .button img{
            width: 0.3rem;
            height: 0.3rem;
            margin-right: 0.12rem;
        }
        .footer .checkbox{
            padding: 0;
            padding-left: 0.2rem;
            width: 0.9rem;
            display: flex;
            flex-direction: column;
        }
        .footer .checkbox input{
            display: none;
        }
        .footer .checkbox span{
            font-size: 0.22rem;
            color: #999999;
            padding-top: 0.1rem;
        }
        .footer .data{
            width: 2.5rem;
            padding-left: 0.5rem;
            padding-right: 0.4rem;
        }
        .footer .data .top{
            font-size: 0.28rem;
            color: #333333;
        }
        .footer .data .top span{
            color: #f91d76;
        }
        .footer .data .bot{
            font-size: 0.24rem;
            color: #999999;
            font-style: italic;
        }
        .footer .data .bot span{
            color: #fa6397;
            text-decoration: underline;
            padding: 0 0.1rem;
        }


        .service{
            background: rgba(0,0,0,0.8);
            width: 100%;
            height: 100%;
            left: 0;
            top: 0;
            position: fixed;
            z-index: 3;
        }

        .service .box{
            width: 6.15rem;
            position: absolute;
            left: 0;
            right: 0;
            margin: auto;
            border-radius: 0.20rem;
            overflow: hidden;
            top: 50%;
            transform: translateY(-50%);
            background: #ffffff;
            max-height: calc(60vh + 2.8rem);
        }
        .service .box .head{
            height: 1.1rem;
            line-height: 1.1rem;
            text-align: center;
            background-image: linear-gradient(to right,#fe7e8c,#f8347d);
            color: #ffffff;
            font-size: 0.32rem;
            position: relative;
        }
        .service .box .head .close{
            width: 0.33rem;
            height: 0.33rem;
            position: absolute;
            right: 0.4rem;
            top: 0;
            bottom: 0;
            margin: auto;
        }
        .service .box .body{
            padding: 0 0.35rem;
            max-height: 60vh;
            overflow-y: auto;
        }
        .service .box .body .tips{
            line-height: 0.86rem;
            font-size: 0.26rem;
            color: #999999;
        }
        .service .box .body .item{
            padding: 0.3rem 0.32rem;
            line-height: 1.6em;
            background: #f7f7f7;
            border: 0.01rem solid #eeeeee;
            border-radius: 0.2rem;
            color: #333333;
            font-size: 0.28rem;
            margin-bottom: 0.28rem;
            display: flex;
            justify-content: flex-start;
            align-items: center;
        }
        .service .box .body .active{
            background-image: linear-gradient(to right,#fe7e8c,#f8347d);
            color: #ffffff;
        }
        .service .box .btn{
            font-size: 0.32rem;
            color: #f8357d;
            line-height: 1rem;
            text-align: center;
            margin-top: 0.7rem;
            border-top: 0.01rem solid #f7f7f7;
        }
        .shangjia_name{
            max-width: 3rem;
        }
    </style>
</head>
<body>
<style>
    .wrap {
        display: flex;
    }
    .category_container {
        max-width: 1.2rem;
        display: flex;
        flex-direction: column;
        justify-content: start;
        align-items: center;
        padding: .14rem 0;
        background: #f7f7f7;
        position: fixed;
        top: 0;
        max-height: 90%;
        height: 130vh;
        overflow-y: auto;
        overflow-x: hidden;
        z-index: 2;
    }
    .category_container span{
        line-height: .94rem;
        font-size: .24rem;
        display: inline-block;
        width: 100%;
        max-width: 1.2rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        /*padding: 0 .14rem;*/
        text-align: center;
        min-width: 1.2rem;
        position: relative;
        flex-shrink: 0;
    }
    .category_container span.active {
        background: #fff;
    }
    .new_show{
        display: block;
    }
    .new_hide{
        display: none;
    }
    .head_img{
        width: 55px;
        height: 55px;
    }
    .category_container span.active{
        background: linear-gradient(to right,#f82079,#fe878e);
        color: #ffffff;
    }

</style>
<div class="wrap">

    <div class="category_container" style="min-width: 1.4rem">
        {loop $ct_shangjia_list $key $row}
        <span class="{if $key==0}active{/if}" data-id="{$row['id']}" data-is_special="{$row['is_special']}">{$row['title']}</span>
        {/loop}
    </div>
    <div class="content" style="padding-left: 1.3rem;flex: 1;background: #f7f7f7">
        {loop $ct_shangjia_list $kk $vv}
            <div class="right_div {if $kk!=0}new_hide{/if}"
                 data-id="{$vv['id']}" data-special="{$vv['is_special']}">

                {if $vv['list_info']}
                    {loop $vv['list_info'] $k1 $v1}

                    <div style="width: 100%;">

                        <div style="font-size: {$sec_txt_size}px;color:{$sec_txt_c};text-align: center;padding-bottom: .2rem;">
                            <span style="padding: .08rem .12rem;background: linear-gradient(to right,{$sec_bk_c1},{$sec_bk_c2});border-radius: 16px;">
                                {if $vv['is_special']==1}
                                    {$v1['title']}({php echo count($v1['courses']);})-任选
                                {else}
                                    {$v1['title']}({php echo count($v1['courses']);}{if count($v1['courses'])>0}可选{$vv['ct_sj_min']}-{$vv['ct_sj']}{/if})
                                {/if}
                            </span>
                        </div>
                        {if $v1['courses']}
                            {loop $v1['courses'] $key $item}
                            <label class="li " style="border-radius: 20px;border-bottom: 0.2rem solid #f7f7f7;">
                                <div class="checkbox">
                                    <input type="checkbox" data-courseid="{$item['id']}" data-shangjia_id="{$item['shangjia_id']}"
                                           data-firid="{$v1['firid']}" data-secid="{$v1['secid']}">
                                    <div class="input">
                                        <img class="checkbox_img" src="{$_G['URL']['BEILAI_IMG']}/ok.png">
                                    </div>
                                </div>
                                <img class="head_img" src="{$item['top_img']}" alt="">
                                <div class="right">
                                    <div class="tit">{$item['name']}</div>
                                    <div class="d_txt shangjia_name" data-shangjia_name="{$item['shangjia_name']}">机构:{$item['shangjia_name']}</div>
                                    {if $item['min_distance']}<div class="d_txt" style="max-width:3rem;" >距离:{$item['min_distance']} km</div>{/if}
                                    <div class="data">
                                        <div class="d_left d_txt">
                                            <div>价值：<span>￥{$item['price']}</span></div>
                                        </div>
                                        <div class="d_right">
                                            <span class="dr_b">已购：{$item['selected_num']}</span>
                                        </div>
                                    </div>
                                </div>
                            </label>
                            <div class="service " style="display: none;">
                                <div class="box">
                                    <div class="head">
                                        <span>请确认上课校区</span>
                                        <img class="close" src="{$_G['URL']['BEILAI_IMG']}/close.png"/>
                                    </div>
                                    <div class="body">
                                        <div class="tips" id="address_prev">点击选择校区</div>
                                        {loop $item['address'] $address_item}
                                        <div class="item">{$address_item}</div>
                                        {/loop}
                                    </div>
                                    <div class="btn">确定</div>
                                </div>
                            </div>
                            {/loop}
                        {/if}
                    </div>
                    {/loop}
                {/if}
            </div>
        {/loop}
    </div>
    <div class="footer">
        <div class="data">
            <!--            可选择课程总数 {$course_num}-->
            <div class="top">已选<span id="choose_num">0</span>个</div>
<!--            <div class="bot">最多选<span>{$course_max_num}</span>门课程</div>-->
        </div>
        <a href="javascript:goNext()" style="color: #ffffff">
        <div class="button">
            <span>下一步</span>
        </div>
        </a>
    </div>


</div>
</body>
<script>
    function getctSj(data,first) {
        let max_sj = 0;
        $.each(data,function (ii,val) {
            if (val.ct_id == first){
                max_sj = val.ct_sj;
                return max_sj;
            }
        });
        return max_sj;
    }
    function getCategorySjNum(first)
    {
        let sj_arr =[];
        let items_input = $(".content .li .checkbox input:checked");
        let items_length = items_input.length;
        for (let i = 0; i<items_length;i++){
            if (items_input.eq(i).data("firid")==first){
                if (sj_arr.indexOf(items_input.eq(i).data("shangjia_id"))==-1){
                    sj_arr.push(items_input.eq(i).data("shangjia_id"))
                }
            }
        }
        return sj_arr.length;
    }
    function getCategorySjAllNum(first,is_checked=0){
        if (is_checked==0){
            let arr_length =0;
            let items_input = $(".content .li .checkbox input:checked");
            let items_length = items_input.length;
            for (let i = 0; i<items_length;i++){
                if (items_input.eq(i).data("firid")==first){
                    arr_length+=1;
                }
            }
            return arr_length;
        }else{
            let arr_length=0;
            let items_input = $(".content .li .checkbox input");
            let items_length = items_input.length;
            for (let i = 0; i<items_length;i++){
                if (items_input.eq(i).data("firid")==first){
                    arr_length+=1;
                }
            }
            return arr_length;
        }

    }
    //获取二级分类
    function getCategorySjSecNum(secid){
        let sj_arr =[];
        let items_input = $(".content .li .checkbox input:checked");
        let items_length = items_input.length;
        for (let i = 0; i<items_length;i++){
            if (items_input.eq(i).data("secid")==secid){
                if (sj_arr.indexOf(items_input.eq(i).data("shangjia_id"))==-1){
                    sj_arr.push(items_input.eq(i).data("shangjia_id"))
                }
            }
        }
        return sj_arr.length;
    }
    function sumTotalsj() {
        let sj_arr1 =[];
        let items_input1 = $(".content .li .checkbox input:checked");
        let items_length1 = items_input1.length;
        for (let i = 0; i<items_length1;i++){
            if (sj_arr1.indexOf(items_input1.eq(i).data("shangjia_id"))==-1){
                sj_arr1.push(items_input1.eq(i).data("shangjia_id"))
            }
        }
        return sj_arr1.length;
    }
    function checkedCategorysJ(list) {
        //循环判断分类下最小选择
        let list_length = list.length;
        for (let i = 0;i<list_length;i++){
            let max_ct_sj = list[i].ct_sj;
            let min_ct_sj = list[i].ct_sj_min;
            let must_ct_sj = 0;
            if (min_ct_sj>0 && max_ct_sj>0){
                must_ct_sj = min_ct_sj;
            }
            if (list[i].is_first==1){
                if (must_ct_sj>0){
                    let first_sj_selected_num = getCategorySjNum(list[i].ct_id);
                    let msg = list[i].ct_name+'分类需选择'+must_ct_sj+'个商家';
                    if (first_sj_selected_num<min_ct_sj){
                        layer.msg(msg);
                        return;
                    }else if (first_sj_selected_num>max_ct_sj){
                        layer.msg(msg);
                        return;
                    }
                }
            }else{
                // if (must_ct_sj>0){
                //     let second_sj_selected_num = getCategorySjSecNum(list[i].ct_id);
                //     let msg = list[i].ct_name+'分类需选择'+must_ct_sj+'个商家';
                //     if (second_sj_selected_num<must_ct_sj){
                //         layer.msg(msg);
                //         return;
                //     }else if (second_sj_selected_num>must_ct_sj){
                //         layer.msg(msg);
                //         return;
                //     }
                // }
            }
        }
    }
</script>
<script>
    let course_min_num="{$course_min_num}";
    let course_max_num="{$course_max_num}";
    let shangjia_select_max="{$shangjia_select_max}";
    let show_shangjia_data = '{$show_shangjia_data}';
    let show_shangjia_category = '{$show_shangjia_category}';
    let gift_total="{$gift_total}";
    show_shangjia_data = JSON.parse(show_shangjia_data);
    show_shangjia_category = JSON.parse(show_shangjia_category);
    console.log(show_shangjia_category)
    let shangjia_arr = new Array();
    $(".content .li .checkbox input").change(function(){
        //非生活类目
        let parents_item_special = $(this).parents('.right_div').data("special");
        if (!parents_item_special){
            {if !$course_mode}
            //控制总量
            let shangjia_id=$(this).data("shangjia_id");
            let index=$(".content .li .checkbox input").index(this);
            let length=$(".content .li .checkbox input:checked").length;
            //判断同一商家一个课程
            for(let i=0;i<length;i++){
                if(index==$(".content .li .checkbox input").index($(".content .li .checkbox input:checked").eq(i)))continue;
                if(shangjia_id==$(".content .li .checkbox input:checked").eq(i).data("shangjia_id")){
                    layer.msg(`同一商家只能选择一个课程`);
                    $(this).removeProp('checked').removeAttr('checked');
                    return;
                }
            }
            //判断同一类别一个商家
            let has_cheked_len = $(this).parents('.right_div').find(".li .checkbox input:checked").length;
            if (has_cheked_len>1){
                layer.msg(`同一类别只能选择一个商家`);
                $(this).removeProp('checked').removeAttr('checked');
                return;
            }
            {else}
                //控制单个商家
                let shangjia_id=$(this).data("shangjia_id");
                let firid=$(this).data("firid");
                let secid=$(this).data("secid");
                let index=$(".content .li .checkbox input").index(this);
                let length=$(".content .li .checkbox input:checked").length;
                let that = $(this);

                //判断二级类
                let sec_sj = getctSj(show_shangjia_category,secid);
                if (sec_sj>0){
                    let selected_sec_sj = getCategorySjSecNum(secid);
                     if (selected_sec_sj>sec_sj){
                        let tmp_msg = '当前商家分类最多选择'+sec_sj+'个商家';
                        layer.msg(tmp_msg);
                        that.removeProp('checked').removeAttr('checked');
                        return;
                    }
                }
                let max_sj = getctSj(show_shangjia_category,firid);
                //判断一级类
                if(max_sj>0){
                    let curt_sj_num = getCategorySjNum(firid);
                    if (curt_sj_num>max_sj){
                        let tmp_msg = '当前商家分类最多选择'+max_sj+'个商家';
                        layer.msg(tmp_msg);
                        that.removeProp('checked').removeAttr('checked');
                        return;
                    }
                }

                $.each(show_shangjia_data,function (ii,val) {

                    if (val.shangjia_id == shangjia_id){
                        let tmp_shangjia_cheked_num = 0;
                        for(let i=0;i<length;i++){
                            if(index==$(".content .li .checkbox input").index($(".content .li .checkbox input:checked").eq(i))){
                                continue;
                            }
                            if(shangjia_id==$(".content .li .checkbox input:checked").eq(i).data("shangjia_id")){

                                tmp_shangjia_cheked_num +=1;
                                if (tmp_shangjia_cheked_num>=val.course_max){
                                    let tmp_msg = '当前商家最多选择'+val.course_max+'个课程';
                                    layer.msg(tmp_msg);
                                    that.removeProp('checked').removeAttr('checked');
                                    return;
                                }
                            }
                        }
                    }
                });


            {/if}

        }
            //生活类目 不限制
            $("#choose_num").html($(".content .li .checkbox input:checked").length);
            if(!$(this).prop("checked")){
                $(".service").eq($(".content .li .checkbox input").index(this)).find(".active").removeClass("active");
                return;
            }
            if($(".service").eq($(".content .li .checkbox input").index(this)).find(".item").length>1){
                $(".service").eq($(".content .li .checkbox input").index(this)).show();
            }else{
                $(".service").eq($(".content .li .checkbox input").index(this)).find(".item").addClass("active");
            }
            $("#choose_num").html($(".content .li .checkbox input:checked").length);
            let sum_course_total = $(".content .li .checkbox input:checked").length;
            if (sum_course_total>course_max_num){
                let tmp_msg = '最多选择'+course_max_num+'个课程';
                layer.msg(tmp_msg);
                $(this).removeProp('checked').removeAttr('checked');
                return;
            }
        });
    $(".service .close").click(function(){
        if($(".service").eq($(".service .close").index($(this))).find(".item.active").length<=0){
            $(".content .li .checkbox input").eq($(".service .close").index($(this))).removeProp('checked').removeAttr('checked');
        }
        $(".service").hide();
    });
    $(".service .btn").click(function(){
        if($(".service").eq($(".service .btn").index($(this))).find(".item.active").length<=0){
            $(".content .li .checkbox input").eq($(".service .btn").index($(this))).removeProp('checked').removeAttr('checked');
        }
        $(".service").hide();
    });
    $(".service .body .item").click(function(){
        $(this).siblings(".item").removeClass("active");
        if($(this).hasClass("active")){
            $(this).removeClass("active");
        }else{
            $(this).addClass("active");
        }
    });
    function goNext(){
        let list = show_shangjia_category;
        let list_length = list.length;
        for (let i = 0;i<list_length;i++){
            let max_ct_sj = list[i].ct_sj;
            let min_ct_sj = list[i].ct_sj_min;
            let must_ct_sj = 0;
            if (min_ct_sj>0 && max_ct_sj>0){
                must_ct_sj = min_ct_sj;
            }
            if (list[i].is_first==1){
                if (must_ct_sj>0){
                    let first_sj_selected_num = getCategorySjNum(list[i].ct_id);
                    let msg = list[i].ct_name+'分类需选择'+must_ct_sj+'个商家';
                    if (first_sj_selected_num<min_ct_sj){
                        layer.msg(msg);
                        return;
                    }else if (first_sj_selected_num>max_ct_sj){
                        layer.msg(msg);
                        return;
                    }
                }
            }
        }
        for (let j=0;j<list_length;j++){
            let max_ct_sj = list[j].ct_sj;
            let min_ct_sj = list[j].ct_sj_min;
            let must_ct_sj1 = 1;
            if (max_ct_sj==0 && min_ct_sj==0){
                must_ct_sj1 =0;
            }
            if (list[j].is_first==1){
                if (must_ct_sj1==0){
                    //获取当前分类下所有选中的
                    let checked_course = getCategorySjAllNum(list[j].ct_id,0);
                    if (checked_course<1){
                        let msg = list[j].ct_name+'分类全部可选择';
                        layer.msg(msg);
                        return;
                    }
                }

            }
        }
        if (shangjia_select_max>0){
            let cur_selected_sj_num = sumTotalsj();
            if (cur_selected_sj_num>shangjia_select_max) {
                layer.msg(`最多只能选择${shangjia_select_max}个商家`);
                return;
            }
        }

        let length=$(".content .li .checkbox input:checked").length;
        if(length<course_min_num){
            layer.msg(`最少选择${course_min_num}个课程`);
            return;
        }
        if(length>course_max_num){
            layer.msg(`最多只能选择${course_max_num}个课程`);
            return;
        }

            let arr=[];
            for(let i=0;i<length;i++){
                let shangjia_id = $(".content .li .checkbox input:checked").eq(i).data("shangjia_id");
                let courseid = $(".content .li .checkbox input:checked").eq(i).data("courseid");
                let index=$(".content .li .checkbox input").index($(".content .li .checkbox input:checked").eq(i));
                let address=$(".service").eq(index).find(".item.active").html();
                let top_img=$(".content .li .head_img").eq(index).attr("src");
                let name=$(".content .li .tit").eq(index).html();
                let shangjia_name=$(".content .li .shangjia_name").eq(index).data("shangjia_name");
                arr.push({
                    shangjia_id,courseid,address,top_img,name,shangjia_name
                });
            }
            let courseStr=JSON.stringify(arr);
            localStorage.setItem("course_address",courseStr);
            if (gift_total<1){
                let url=`/{php echo createMobileUrl('wx', array('themeid'=>$themeid,'from'=>'mobile','r'=>'beilai.index.payconfirm','joinid'=>$joinid,'recordid'=>$recordid,'grouprice'=>$grouprice));}`;
                window.location.href=url;
            }else{
                let url=`/{php echo createMobileUrl('wx', array('themeid'=>$themeid,'from'=>'mobile','r'=>'beilai.index.gift','joinid'=>$joinid,'recordid'=>$recordid,'grouprice'=>$grouprice));}`;
                window.location.href=url;
            }

        }

        // 添加类别
        $('.category_container span').click(function () {
            $(this).siblings('span').removeClass('active');
            const tmp_index = $(this).index();
            if($(this).hasClass('active')) {
                // $(this).removeClass('active')
            }else {
                $('.right_div').siblings().addClass('new_hide');
                $('.right_div').eq(tmp_index).removeClass('new_hide')

                $(this).addClass('active');
            }
            if ($(this).data("is_special")==1){
                layer.msg('当前分类下可全选');
            }
            checkedCategorysJ(show_shangjia_category);
        })
</script>
{include file='base/addlog'}
</html>